package com.atguigu.order.feign;

import com.atguigu.order.feign.impl.ProductFeignImpl;
import com.atguigu.product.bean.Product;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author fhs
 * Create by 2025/6/24 11:05
 */
//超时后连不上服务就会进入到假数据，ProductFeignImpl.class
//feign客户端的名字应该是contextId进行指明的，不写的话默认是value对的值
//@FeignClient(value = "service-product",contextId = "",fallback = ProductFeignImpl.class)
@FeignClient(value = "service-product",fallback = ProductFeignImpl.class)
public interface ProductFeignClient {

    //这里是将Long id放入到路径中
    @GetMapping("/product/{id}")
    Product getProduct(@PathVariable("id") Long id);
}
